import { GET_PROFILE, GET_PROFILES, PROFILE_LOADING, CLEAR_CURRENT_PROFILE } from '../actions/types'
const initialState = {
  profile: null,//个人信息
  profiles: null,//多个信息
  loading: false,//加载动画 
}
export default function (state = initialState, action) {
  switch (action.type) {
    case PROFILE_LOADING://加载动画
      return {
        ...state,
        loading: true
      }
    case GET_PROFILE: //用户信息
      return {
        ...state,
        profile: action.payload,
        loading: false
      }
    case GET_PROFILES: //有开发人员信息数据
      return {
        ...state,
        profiles: action.payload,
        loading: false
      }
    case CLEAR_CURRENT_PROFILE: //清除用户信息
      return {
        ...state,
        profile: null,
        loading: false
      }
    default:
      return {
        ...state,
        loading: false

      };
  }

}